<div class="container">
	<div class="span-17 main-content">
		
		<h2>  <%= @tutorial.name %> </h2>
        
        <div class="tutorial_meta_data">
				Napisao <%= link_to @tutorial.member.username, @tutorial.member %> <%= @tutorial.created_at %> 
				</div>
       <!-- Linkovi za moderatora -->
        <% if moderator? then %>
            <div class="admin_options">
                <%= image_tag('black_icons/wrench.png', :class=>'menu_icon' ) %>
                <%= link_to "Edit", edit_tutorial_path(@tutorial) %>
            </div>
        <% end %>
        <!-- Kraj linkova za moderatora -->
        
        <div class="tutorial-description">
            <%= @tutorial.description %>
        </div>
        
        <div>
            <%= raw parse_bbcode(@tutorial.content,false) %>
        </div>
        
        <!-- Tutoriali iz kategorije -->    
        <table class="admin" style="margin-top: 30px;">
        	<tr>
        		<th class="admin narrow"></th>
        		<th class="admin"><%=@tutorial.tutorial_category.name%></th>
        	</tr>
        
        	<% i=0; @tutorial.tutorial_category.tutorials.order('id').each do |tutorial| %>
          	<% i += 1 %>
          	
	          	<tr>
	          		<td class="admin narrow"><%= i %>.</td>
	            	<td class="admin">
	            		<% if tutorial == @tutorial %>
	               			<b><%= tutorial.name%></b>
	            		<% else %>
	              			<%= link_to tutorial.name, frontend_tutorial_path(tutorial.slug) %>
	            		<% end %>
	            	</td>
	          	</tr>
        	
        	<% end %>
        </table>
        <!-- Kraj tutoriala iz kategorije -->
        
        
        <h2 class="comments">Komentari</h2>
        
        <div id="comments">
            <% @tutorial.comments.order("created_at").all.each do |comment| @comment = comment %>
            <%= render 'comments/comment' %>
            <% end %>
        </div>
        
        <h3 class="comments">Moj komentar</h3>
        <% @comment = Comment.new %>
        <%= render 'comments/form' %>

    </div>
    <%= render 'shared/sidebar' %>

</div>
